package com.gitee.huxing.course.listener;

import org.springframework.jms.annotation.JmsListener;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Description: Topic消费者
 * @ProjectName: JavaCourse
 * @Package: com.gitee.huxing.course.controller
 * @ClassName: TopicConsumerListener
 * @Author: huxing
 * @DateTime: 2021-10-29 1:22 下午
 */
public class TopicConsumerListener {

    @JmsListener(destination="${spring.activemq.topic-name}", containerFactory="topicListener")
    public void readActiveQueue(String message) {
        final AtomicInteger count = new AtomicInteger(0);
        System.out.println(count.incrementAndGet() + " => receive from " + message);
    }
}
